<?php
$runValidation = false;
if(isset($this->validation)){
	$runValidation = true;
}
$className="";
?>
<div id="content">
	<div class="col1">
		<div class="col-padding">
			&nbsp;
		</div>
	</div>
	<div class="col2">
		<div class="col-padding">
			<h2>Create a Club</h2>
			<p>Paragraph/directions go here</p>
			<form id="handleCreate" action="/<?=$form_action?>" method="post">
			<?php if($this->phpsession->flashget("error")!=""): ?>
				<div class="error-box">
					<div class="container-padding">
						<p>
						<?= $this->phpsession->flashget("error") ?>
						</p>
					</div>
				</div>
				<?php endif; ?>
				<div class="container">
				<div class="container-padding">
					<h3>Basic Information</h3>
					<div class="line-h line-padding"></div>
					<div class="input-div">
								<?php if($runValidation) { if($this->validation->clubname_error!="") { $className="form-error"; } else { $className=""; } } ?>
						<label for="clubname"><span class="required">Club Name:</span></label>
						<input type="text" class="<?=$className ?>" name="clubname" id="clubname" value="<?php if(isset($default_values["clubname"])) { echo $default_values["clubname"]; } ?>" size="30" maxlength="30"/>
						<div class="cleardiv"></div>
					</div>
					<div class="input-div">
					<?php if($runValidation) { if($this->validation->passwd_error!="") { $className="form-error"; } else { $className=""; } } ?>
						<label for="passwd"><span class="required">Admin Password:</span></label>
						<input type="password" name="passwd" id="passwd" class="<?=$className ?>" value="<?php if(isset($default_values["passwd"])) { echo $default_values["passwd"]; } ?>" size="20" maxlength="40"/>
						<div class="cleardiv"></div>
					</div>
					<div class="input-div">
					<?php if($runValidation) { if($this->validation->passwd_error!="") { $className="form-error"; } else { $className=""; } } ?>
						<label for="passwd2"><span class="required">Re-type Password:</span></label>
						<input type="password" name="passwd2" id="passwd2" class="<?=$className ?>" value="<?php if(isset($default_values["passwd2"])) { echo $default_values["passwd2"]; } ?>" size="20" maxlength="40"/>
						<div class="cleardiv"></div>
					</div>
					<div class="input-div">
						<label for="website"><span>Website:</span></label>
						<input type="text" name="website" id="website" value="<?php if(isset($default_values["website"])) { echo $default_values["website"]; } ?>" size="30" maxlength="60"/>
						<div class="cleardiv"></div>
					</div>
					<div class="input-div">
						<label for="admin">I am the admin for this club:</label>
						<?php if(isset($default_values["admin"])&& $default_values["admin"]==true):?>
						<input type="checkbox" name="admin" id="admin" checked="true" />
						<?php else: ?>
						<input type="checkbox" name="admin" id="admin" />
						<?php endif; ?>
					</div>
					<?/* Location Information */?>
					<div>
						<h3 style="float:left;">Location Info</h3>
						<div style="float:right;">
							<label for="noLocation">This club does not have a location</label>
							<?php $checked=""; ?>
							<?php if(isset($default_values["noLocation"]) && $default_values["noLocation"]=="on") { $checked="checked\"true\""; } ?>
							<input type="checkbox" id="noLocation" <?=$checked ?> name="noLocation" onclick="toggleBlock('Locations');" />
						</div>
						<div class="cleardiv"></div>
					</div>
					<div class="line-h line-padding"></div>
					<?php if(isset($default_values["noLocation"]) && $default_values["noLocation"]=="on"): ?>
					<div style="display:none;" id="dLocations">
					<?php else: ?>
						<div style="display:block;" id="dLocations">
						<?php endif; ?>
							<div class="input-div">
							<?php if($runValidation) { if($this->validation->locname_error!="") { $className="form-error"; } else { $className=""; } } ?>
								<label for="locname"><span class="required">Location Name:</span></label>
								<input type="text" class="<?=$className ?>" name="locname" value="<?php if(isset($default_values["locname"])) { echo $default_values["locname"]; } ?>" id="locname" size="30" maxlength="40" />
							</div>
							<div class="input-div">
								<label for="address1">Address 1:</label>
								<input type="text" name="address1" value="<?php if(isset($default_values["address1"])) { echo $default_values["address1"]; } ?>" id="address1" size="30" maxlength="40" />
							</div>
							<div class="input-div">
								<label for="address2">Address 2:</label>
								<input type="text" name="address2" value="<?php if(isset($default_values["address2"])) { echo $default_values["address2"]; } ?>" id="address2" size="30" maxlength="40" />
							</div>
							<div class="input-div">
								<label for="city">City:</label>
								<input type="text" name="city" id="city" size="10" maxlength="20" value="<?php if(isset($default_values["city"])) { echo $default_values["city"]; } ?>"/>
							</div>
							<div class="input-div">
								<label for="city">State:</label>
								<select name="state" id="state">
									<option value="">Select One</option>
									<?php
									foreach($state->result() as $row) { ?>
									<option value="<?=$row->state_abbr ?>" <?php if(isset($default_values["state"]) && $default_values["state"]==$row->state_abbr) { echo "selected=\"true\""; } ?>><?=$row->state_abbr?></option>
									<?php } ?>
								</select>
							</div>
							<div class="input-div">
							<?php if($runValidation) { if($this->validation->zipcode_error!="") { $className="form-error"; } else { $className=""; } } ?>
								<label for="zipcode"><span class="required">Postal Code:</span></label>
								<input type="text" name="zipcode" id="zipcode" class="<?=$className?>" size="5" maxlength="5" value="<?php if(isset($default_values["zipcode"])) { echo $default_values["zipcode"]; } ?>"/>
							</div>
							<div class="input-div">
							<?php if($runValidation) { if($this->validation->location_type_error!="") { $className="form-error"; } else { $className=""; } } ?>
								<label for="location_type"><span class="required">Location Type:</span></label>
								<select name="location_type" id="location_type" class="<?=$className?>">
									<option value="">Select One</option>
									<?php
									foreach($location_type->result() as $row) { ?>
									<option value="<?=$row->location_type ?>" <?php if(isset($default_values["location_type"]) && $default_values["location_type"]==$row->location_type) { echo "selected=\"true\""; } ?>><?=$row->location_type?></option>
									<?php } ?>
								</select>
							</div>
						</div> <?/* END SWITCH DIV FOR LOCATIONS */?>
						<?/* Member Setup Information */?>
						<h3>Members Setup</h3>
						<div class="line-h line-padding"></div>
						<div class="input-div">
							<label class="club_privacy"><span class="required">Club Privacy:</span></label>
							<select id="club_privacy" name="club_privacy">
							<?php
								foreach($privacy->result() as $row) { ?>
								<option value="<?=$row->club_privacy ?>"><?=$row->description ?></option>
								<?php } ?>
							</select>
						</div>
						<div class="input-div">
						<?php if($runValidation) { if($this->validation->codeword_error!="") { $className="form-error"; } else { $className=""; } } ?>
							<label for="codeword"><span class="required">Member Codeword:</span></label>
							<input type="text" name="codeword" id="codeword" class="<?=$className ?>" size="20" maxlength="30" value="<?php if(isset($default_values["codeword"])) { echo $default_values["codeword"]; } ?>"/>
						</div>
						
						<h3>Mission Statement</h3>
						<div class="line-h line-padding"></div>
						<div class="input-div" style="text-align:center;">
							<textarea name="mission" id="mission" cols="59" rows="10"><?php if(isset($default_values["mission"])) { echo $default_values["mission"]; } ?></textarea>
						</div>

						<h3>Welcome Message</h3>
						<div class="line-h line-padding"></div>
						<div class="input-div" style="text-align:center;">
							<textarea name="welcome_note" id="welcome_note" cols="59" rows="10"><?php if(isset($default_values["welcome_note"])) { echo $default_values["welcome_note"]; } ?></textarea>
						</div>
						
						<?/*-- SUBMIT --*/?>
						<div class="line-h line-padding" style="margin-top:20px;"></div>
						<div class="container-padding">
							<div class="input-div">
								<input type="reset" value="Reset" style="float:left;" />
								<input type="submit" value="<?=$form_button?>" style="float:right;" />
								<div class="cleardiv"></div>
							</div>
						</div>
					</div>
				</div>
			</form>
		</div>
	</div>
	<div class="col3">
		<div class="col-padding">
			&nbsp;
		</div>
	</div>
</div>